﻿<ValidateForm class="form-inline" Model="@Item" OnValidSubmit="@Hi">
    <div class="row" style="border: 1px solid;">
        <div class="form-group col-1">
            @(Item.Id)
        </div>
        <div class="form-group col-2">
            <BootstrapInput @bind-Value="@Item.Name" placeholder="不可为空，50字以内" maxlength="50" @onblur="@Hi" />
        </div>
        <div class="form-group col-2">
            <BootstrapPassword @bind-Value="@Item.Password" maxlength="50" @onblur="@Hi" />
        </div>
        <div class="form-group col-2">
            <BootstrapInput @bind-Value="@Item.Address" placeholder="不可为空，50字以内" maxlength="50" @onblur="@Hi" />
        </div>
        <div class="form-group col-2">
            <DateTimePicker @bind-Value="@Item.DateTime" @onblur="@Hi" />
        </div>
        <div class="form-group col-1">
            <Select @bind-Value="@Item.Education" @onblur="@Hi" />
        </div>
        <div class="form-group col-1">
            <Switch @bind-Value="@Item.Complete" ShowInnerText="true" @onblur="@Hi" />
        </div>
        <div class="form-group col-1">
            <Button Text="OK" OnClick="@Hi" />
            @*<Button ButtonType="ButtonType.Submit" Text="提交表单" />*@
        </div>
    </div>
</ValidateForm>

@code {

    [Parameter]
    public Foo Item { get; set; } = new Foo() { Name = "张三" };

    /// <summary>
    /// 调试信息回调方法
    /// </summary>
    [Parameter]
    public EventCallback<Foo> ModelChanged { get; set; }

    async Task Hi(object x)
    {
       if (ModelChanged.HasDelegate) await ModelChanged.InvokeAsync(Item);
    }

}
